* that is wants to read and write GPX files on a
* mounted drive. Try that now.
*/
- gdx = gdx_find_file(".", NULL);
+ gdx = gdx_find_file(".");
if (gdx) return 1;
/* Plan C. */
fatal("Found no Garmin USB devices.\n");
static route_head *cur_rte = NULL;
static double pos_dist;
+static double max_diff_time;
static char *distopt = NULL;
+static char *timeopt = NULL;
static char *purge_duplicates = NULL;
+static int check_time;
typedef struct {
double distance;
{"all", &purge_duplicates,
"Suppress all points close to other points",
NULL, ARGTYPE_BOOL, ARG_NOMINMAX },
+ {"time", &timeopt, "Maximum time in seconds beetween two points",
+ NULL, ARGTYPE_FLOAT | ARGTYPE_REQUIRED, ARG_NOMINMAX },
ARG_TERMINATOR
};
queue * elem, * tmp;
waypoint ** comp;
int * qlist;
- double dist;
+ double dist, diff_time;
int i = 0, j, anyitem;
comp = (waypoint **) xcalloc(nelems, sizeof(*comp));
/* convert radians to integer feet */
dist = (int)(5280*radtomiles(dist));
-
+ diff_time = fabs( waypt_time(comp[i]) - waypt_time(comp[j]) );
+
if (dist <= pos_dist) {
+ if(check_time && diff_time >= max_diff_time)
+ continue;
+
qlist[j] = 1;
switch (qtype) {
case wptdata:
char *fm;
pos_dist = 0;
+ max_diff_time = 0;
+ check_time = 0;
if (distopt) {
pos_dist = strtod(distopt, &fm);
pos_dist *= 3.2802;
}
}
+
+ if (timeopt) {
+ check_time = 1;
+ max_diff_time = strtod(timeopt, &fm);
+ }
}
void
--- /dev/null
+<para>
+ Specifies the maximum time in seconds between any two points. If the
+ time difference is larger than what's specified here, the points will
+ not be discarded.
+</para>
+<para>
+ This is useful if you have multiple tracks of the same course and you'd
+ like the filter to consider the tracks the same.
+</para>